Public Class VText_Factory
    Public Sub SaveText( _
                        ByVal oView As SQLAutoDocLib.View, _
                        ByVal sText As String)

        Dim oFactory As New DBVText_Factory

        oFactory.ClearText(oView.ID, oView.RevID)

        Dim sBuffer As String
        Dim iPos As Integer = 0
        Dim iOrder As Integer = 0

        Do While (iPos + 8000) < sText.Length
            sBuffer = sText.Substring(iPos, 8000)
            iPos = iPos + 8001

            oFactory.AddText(oView.ID, oView.RevID, iOrder, sBuffer)
            iOrder = iOrder + 1
        Loop

        If iPos < sText.Length Then
            sBuffer = sText.Substring(iPos, sText.Length - iPos)
            oFactory.AddText(oView.ID, oView.RevID, iOrder, sBuffer)
        End If
    End Sub

    Public Function GetText( _
        ByVal lViewID As Long, _
        ByVal lViewRevID As Long) As String

        Dim oFactory As New DBVText_Factory

        Return oFactory.GetText(lViewID, lViewRevID)
    End Function
End Class
